import { createI18n } from 'vue-i18n'
// @ts-ignore
import messages from '@intlify/vite-plugin-vue-i18n/messages'
import type { App } from 'vue'

// get global locale
export const i18n = createI18n({
    legacy: false,
    locale: 'zh-CN',
    messages
})

export const setupI18n = (app: App) => {
    app.use(i18n)
}

export const useI18n = () => {
    return i18n.global
}
